home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 233 / text0000.txt < prev   
Encoding:
Text File  |  1996-08-06  |  2.1 KB  |  45 lines

  1. In article <DLzK76.88@ukpsshp1.serigate.philips.nl>
  2. baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes) writes: 
  3. <snip>
  4.    compiler - even if it then goes on to generate useful code. The whole point
  5.    about a standard compiler is that if code compiles clean on one, it should
  6.    compile clean on all.
  7.  
  8. Incorrect if by clean you mean `warning-free'. A compiler can generate
  9. as many warnings as it likes, and still be conformant: the only
  10. requirement is that it actually create the executable, which when
  11. executed has the correct behaviour.
  12.  
  13. Incorrect if you mean that it should compile on all, clean or not. If
  14. a program invokes undefined behaviour, anything can happen. It can
  15. compile absolutely diagnostic free on one conforming compiler and
  16. terminate compilation on another.
  17.  
  18. Thus, according to the definition of `conforming' program, the
  19. following is a conforming program:
  20.  
  21. double main (float x, void *y[1]) { *(char*)0 = *(char*)y; 
  22.                                     printf(x++ = x++ + 3); } 
  23.  
  24. And let us not forget that the `translation limits' clause can be read
  25. to mean that a compiler needs to accept one specific (rather unusual)
  26. program to be called conforming. So, a conforming compiler can reject
  27. strictly conforming code as well. (I do not accept this reading of the
  28. clause: but it seems to be the what the standard most plainly says).
  29.  
  30. And let us not forget that given any conforming implementation, it is
  31. extremely easy to create another conforming implementation which
  32. accepts any program with atmost one warning. So, fortran can be
  33. trivially made into conforming c by writing a shell script around gcc
  34. and calling it an implementation :-)
  35.  
  36. Cheers
  37. Tanmoy
  38. --
  39. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  40. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  41. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  42. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  43. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  44. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  45.